<template>
<div>
  <Form :model="form">
    <FormItem lable="公告内容">
      <Input style="width: 250px" v-model="form.content"></Input>
    </FormItem>
    <FormItem lable="发布时间">
        <DatePicker type="date" v-model="form.create_date"  placeholder="请选择时间" ></DatePicker>
    </FormItem>
    <FormItem>
      <Button type="primary" style="margin: 15px" @click="updateNotice">提交</Button>
      <Button type="text" @click="quxiao" >取消</Button>
    </FormItem>
  </Form>
</div>
</template>

<script>
export default {
  name: "UpdateNotice",
  props:["Data"],
  data(){
    return{
      form:[]
    }
  },
  methods:{
    updateNotice(){
      this.form.create_date=(new Date(this.form.create_date)).toLocaleDateString()
      this.http.post("/UpdateNotice",this.qs.parse(this.form)).then(res=>{
        if (res.data){
          this.$Message.success("修改成功啦")
          this.$emit("hideDialog")
          this.$emit("after")
        }else {
          this.$Message.error("修改失败")
        }
      })
    },
    quxiao(){
      this.$emit("hideDialog")
    }
  },
  created() {
    this.form=this.Data
  }
}
</script>

<style scoped>

</style>
